package com.ysd.repository;

import javax.transaction.Transactional;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import com.ysd.entity.Users;


public interface UserRepositpry extends JpaRepository<Users,String>,JpaSpecificationExecutor<Users>{
	@Query(value = "SELECT * FROM Users WHERE LoginName=?1 and Password =?2",nativeQuery = true)
	Users findByadmin(String login_name,String password);
	
	
	//重置密码
	//修改状态为上机
		@Query(value = "UPDATE users set Password ='admin' WHERE Id=?1",nativeQuery = true)  
	    @Modifying  
	    @Transactional 
		Integer uppassword(String id);

}
